com.supermap.mapping

Class TrackingLayer

  • java.lang.Object
    • com.supermap.mapping.TrackingLayer


  • public class TrackingLayer
    extends java.lang.Object
    The TrackingLayer class.

    In the SuperMap, there is a tracking layer in each map view. Exactly speaking, there is a tracking layer when displaying each map. Traing layer is an empty transparent layer. It locates the top of all layers. It is used for saving some images and text temporaryly during an analysis or processing. As long as the map is being displayed, the tracking layer will exist and you cannot delete the tracking layer or change its position.

    In SuperMap iMobile, the tracking layer can be used in:

    When you don't want to add geometric objects to the record set, but you need this geometric objects to make your operation work, then you can add the geometric objects to the tracking layer. When your operation is done, and the geometric objects is no longer needed, you can just delete this tracking layer. For example, when you want to draw a line to measure the distance, then you can make use of the tracking layer.

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      int add(Geometry geometry, java.lang.String tag)
      Adds a geometric object to this TrackingLayer, and gives the tag of this geometric object.
      boolean addLabel(java.lang.String name, TextStyle style, boolean visible, boolean tail)
      Adds the field created by the users to the tracking layer to display.
      void clear()
      Clears all the geometric objects in the tracking layer.
      boolean createUserFieldDouble(java.lang.String name, int size, int attr)
      The user field information that creates Double field type in the current tracking layer.
      boolean createUserFieldInt(java.lang.String name, int size, int attr)
      The user field information that creates Int field type in the current tracking layer.
      boolean createUserFieldString(java.lang.String name, int size, int attr)
      The user field information that creates String field type in the current tracking layer.
      void deleteAllFeatures()
      Deletes all the attribute information of the tracking layer field, including the geometry objects and field information in tracking layer, and the attribute table is still exist.
      boolean deleteUserField(java.lang.String fieldname)
      Deletes the field of the specified name in tracking layer.
      boolean flushBulkEdit()
      Conducts the batch update to the tracking layer.
      Geometry get(int id)
      Returns the geometric object with the specified index in this tracking layer.
      int getCount()
      Returns the count of geometric objects in the tracking layer.
      int GetEvent(java.lang.String tag)
      Gets the index of the geometric object with the specified label in this TrackingLayer.
      double getFieldDouble(int index, java.lang.String fieldname)
      Gets the Double filed value of the specified field name of the specified ID in the tracking layer.
      FieldInfo getFieldInfo(java.lang.String fieldname)
      Gets the field information of the specified field name in the tracking layer.
      FieldInfos getFieldInfos()
      Gets the FieldInfos in the tracking layer.
      int getFieldInt(int index, java.lang.String fieldname)
      Gets the Int filed value of the specified field name of the specified ID in the tracking layer.
      java.lang.String getFieldName(int index)
      Gets the field name of the specified field ID crested by user in the tracking layer.
      java.lang.String getFieldString(int index, java.lang.String fieldname)
      Gets the String filed value of the specified field name of the specified ID in the tracking layer.
      java.lang.String getTag(int index)
      Returns the tag of geometric object with the specified ID in this tracking layer.
      int hitTest(Point2D point2D, double tolerance)
      Returns the ID of the geometric objects that meet the condition.
      int[] hitTestAll(Point2D point, double tolerance)
      Returns all ids of geometry objects that meet the criteria.
      int hitTestEx(Point point, int tolerance)
      Returns the ID of the geometric objects that meet the condition.
      int[] hitTestExAll(Point point, int tolerance)
      Returns all ids of geometry objects that meet the criteria.
      int indexOf(java.lang.String tag)
      Returns the ID of the first geometric object which is identical with the specified tag.
      boolean isAsyncRefresh()
      Returns whether to render the tracing layer instantly
      boolean isSymbolScalable()
      Returns whether the size of the symbol in the tracking layer changes with the map zoom.
      boolean isVisible()
      Returns whether the tracking layer is visible, with true indicating visible and false indicating not visible.
      boolean labelMoveBottom(java.lang.String tag)
      Brings the field of the specified name in tracking layer to the bottom.
      boolean labelMoveDown(java.lang.String tag)
      Brings the field of the specified name in tracking layer down.
      boolean labelMoveTop(java.lang.String tag)
      Brings the field of the specified name in tracking layer to the top.
      boolean labelMoveUp(java.lang.String tag)
      Brings the field of the specified name in tracking layer up.
      void refresh()
      Track layer refreshes
      boolean remove(int index)
      Deletes the geometric object with the given index in the current TrackingLayer.
      boolean removeLabel(java.lang.String fieldname)
      Removes the field displayed in current tracking layer.
      boolean set(int index, Geometry geometry)
      Replaces the geometric object at the specified index in the TrackingLayer with the specified geometric object and removes the original geometric object.
      void setAsyncRefresh(boolean bAsync)
      Sets whether to render the tracing layer instantly
      boolean setEditBulk(boolean bulkon)
      Starts the bulk update in the current tracking layer.
      boolean setFieldDouble(java.lang.String fieldname, double dVar)
      Sets the Double value of the specified name field of the newly added point object in this tracking layer.
      boolean setFieldDoubleEx(java.lang.String fieldname, double dVar, int index)
      Sets the Double value of the specified field of the specified record in the tracking layer.
      boolean setFieldInt(java.lang.String fieldname, int iVar)
      Sets the Int value of the specified name field of the newly added point object in this tracking layer.
      boolean setFieldIntEx(java.lang.String fieldname, int iVar, int index)
      Sets the Int value of the specified field of the specified record in the tracking layer.
      boolean setFieldString(java.lang.String fieldname, java.lang.String strVar)
      Sets the String value of the specified name field of the newly added point object in this tracking layer.
      boolean setFieldStringEx(java.lang.String fieldname, java.lang.String strVar, int index)
      Sets the String value of the specified field of the specified record in the tracking layer.
      void setGuideLineStyle(GeoStyle style)
      Sets the style of the guide line.
      boolean setLabelCaption(java.lang.String fieldname, java.lang.String Caption)
      Sets the label alias of the specified name in tracking layer.
      boolean setLabelOffset(java.lang.String fieldname, short x, short y)
      Sets the specified field offset of the specified name in the tracking layer.
      boolean setLabelTextStyle(java.lang.String fieldname, TextStyle style)
      Sets the field label text style of the specified name as the specified style in this tracking layer.
      boolean setLabelVisible(java.lang.String fieldname, boolean visible)
      Sets whether the field label of the specified name is visible in tracking layer.
      void setShowGuideLine(boolean bShow, GeoLineM[] routes, Point2D start, Point2D end)
      Sets whether to display the guide lines of the starting point and the ending point
      void setSymbolOffset(short x, short y)
      Sets the specified offset of geometry object in the tracking layer.
      boolean setTag(int index, java.lang.String tag)
      Sets the tag of geometric object with the specified ID in this tracking layer.
      void setVisible(boolean value)
      Sets whether the tracking layer is visible, with true indicating visible and false indicating not visible.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • getCount

        public int getCount()
        Returns the count of geometric objects in the tracking layer.
        Returns:
        The count of geometric objects in this tracking layer.
        Default:
        The default value is 0.
      • isVisible

        public boolean isVisible()
        Returns whether the tracking layer is visible, with true indicating visible and false indicating not visible.
        Returns:
        True or false indicating whether the tracking layer is visible.
        Default:
        The default value is true.
      • setVisible

        public void setVisible(boolean value)
        Sets whether the tracking layer is visible, with true indicating visible and false indicating not visible.
        Parameters:
        value - True or false indicating whether the tracking layer is visible.
      • isSymbolScalable

        public boolean isSymbolScalable()
        Returns whether the size of the symbol in the tracking layer changes with the map zoom. True means the size changes with the map zoom. When the map zooms in, symbols will also zoom in at the same time.
        Returns:
        True or false indicating whether the size of the symbol in the tracking layer changes with the map zoom.
        Default:
        The default value is false.
      • add

        public int add(Geometry geometry,
                       java.lang.String tag)
        Adds a geometric object to this TrackingLayer, and gives the tag of this geometric object.
        Parameters:
        geometry - The Geometry object to be added.
        tag - The label of the geometric instance to be added.
        Returns:
        The geometry object index added to the tracking layer, namely, the ID of this geometry object.
        Example:
        Please see the sample of TextStyle.
      • addLabel

        public boolean addLabel(java.lang.String name,
                                TextStyle style,
                                boolean visible,
                                boolean tail)
        Adds the field created by the users to the tracking layer to display.
        Parameters:
        name - The field name created by users.
        style - The text style of the added field.
        visible - Whether the added filed is visible. True represents visible; Otherwise, false.
        tail - Whether the added label position is the previous layer or the next layer. true is the previous layer and false is the next layer.
        Returns:
        True if successful; otherwise, false.
      • createUserFieldDouble

        public boolean createUserFieldDouble(java.lang.String name,
                                             int size,
                                             int attr)
        The user field information that creates Double field type in the current tracking layer.
        Parameters:
        name - Creates name of the field.
        size - Creates length of the field.
        attr - Creates the attribute of field and the default value is 0.
        Returns:
        True, if successful; Otherwise false.
      • createUserFieldInt

        public boolean createUserFieldInt(java.lang.String name,
                                          int size,
                                          int attr)
        The user field information that creates Int field type in the current tracking layer.
        Parameters:
        name - Creates name of the field.
        size - Creates length of the field.
        attr - Creates the attribute of field and the default value is 0.
        Returns:
        True, if successful; Otherwise false.
      • createUserFieldString

        public boolean createUserFieldString(java.lang.String name,
                                             int size,
                                             int attr)
        The user field information that creates String field type in the current tracking layer.
        Parameters:
        name - Creates name of the field.
        size - Creates length of the field.
        attr - Creates the attribute of field and the default value is 0.
        Returns:
        True, if successful; Otherwise false.
      • deleteAllFeatures

        public void deleteAllFeatures()
        Deletes all the attribute information of the tracking layer field, including the geometry objects and field information in tracking layer, and the attribute table is still exist.
      • deleteUserField

        public boolean deleteUserField(java.lang.String fieldname)
        Deletes the field of the specified name in tracking layer.
        Parameters:
        fieldname - The field name to be deleted.
        Returns:
        Returns true if successful; otherwise false.
      • flushBulkEdit

        public boolean flushBulkEdit()
        Conducts the batch update to the tracking layer.
        Returns:
        Returns true If successful; otherwise false.
      • GetEvent

        public int GetEvent(java.lang.String tag)
        Gets the index of the geometric object with the specified label in this TrackingLayer.
        Parameters:
        tag - The label of the geometric instance.
        Returns:
        The ID of the Geometry object.
      • getFieldDouble

        public double getFieldDouble(int index,
                                     java.lang.String fieldname)
        Gets the Double filed value of the specified field name of the specified ID in the tracking layer.
        Parameters:
        index - The specified ID
        fieldname - The name of the specified field.
        Returns:
        Field value.
      • getFieldInt

        public int getFieldInt(int index,
                               java.lang.String fieldname)
        Gets the Int filed value of the specified field name of the specified ID in the tracking layer.
        Parameters:
        index - The specified ID
        fieldname - The name of the specified field.
        Returns:
        Field value.
      • getFieldString

        public java.lang.String getFieldString(int index,
                                               java.lang.String fieldname)
        Gets the String filed value of the specified field name of the specified ID in the tracking layer.
        Parameters:
        index - The specified ID
        fieldname - The name of the specified field.
        Returns:
        Field value.
      • getFieldInfo

        public FieldInfo getFieldInfo(java.lang.String fieldname)
        Gets the field information of the specified field name in the tracking layer.
        Parameters:
        fieldname - The name of the specified field.
        Returns:
        The field information.
      • getFieldInfos

        public FieldInfos getFieldInfos()
        Gets the FieldInfos in the tracking layer.
        Returns:
        The FieldInfos.
      • getFieldName

        public java.lang.String getFieldName(int index)
        Gets the field name of the specified field ID crested by user in the tracking layer.
        Parameters:
        index - The field ID crested by user.
        Returns:
        The name of the field.
      • labelMoveUp

        public boolean labelMoveUp(java.lang.String tag)
        Brings the field of the specified name in tracking layer up.
        Parameters:
        tag - The name of the specified label.
        Returns:
        True, if successful; Otherwise false.
      • labelMoveDown

        public boolean labelMoveDown(java.lang.String tag)
        Brings the field of the specified name in tracking layer down.
        Parameters:
        tag - The name of the specified label.
        Returns:
        True, if successful; Otherwise false.
      • labelMoveBottom

        public boolean labelMoveBottom(java.lang.String tag)
        Brings the field of the specified name in tracking layer to the bottom.
        Parameters:
        tag - The name of the specified label.
        Returns:
        True if successful; Otherwise, false.
      • labelMoveTop

        public boolean labelMoveTop(java.lang.String tag)
        Brings the field of the specified name in tracking layer to the top.
        Parameters:
        tag - The name of the specified label.
        Returns:
        True if successful; Otherwise, false.
      • remove

        public boolean remove(int index)
        Deletes the geometric object with the given index in the current TrackingLayer.
        Parameters:
        index - The ID of the geometric object to be deleted.
        Returns:
        returns true if successful; otherwise false.
      • removeLabel

        public boolean removeLabel(java.lang.String fieldname)
        Removes the field displayed in current tracking layer.
        Parameters:
        fieldname - The field name of Value to delete.
        Returns:
        returns true if successful; otherwise false.
      • setEditBulk

        public boolean setEditBulk(boolean bulkon)
        Starts the bulk update in the current tracking layer.
        Parameters:
        bulkon - A bool, true means opened and otherwise false.
        Returns:
        Returns true if bulkon is true; Otherwise false.
      • setFieldDouble

        public boolean setFieldDouble(java.lang.String fieldname,
                                      double dVar)
        Sets the Double value of the specified name field of the newly added point object in this tracking layer.
        Parameters:
        fieldname - The name of the specified field.
        dVar - The value of the specified field.
        Returns:
        True if successful; otherwise, false.
      • setFieldDoubleEx

        public boolean setFieldDoubleEx(java.lang.String fieldname,
                                        double dVar,
                                        int index)
        Sets the Double value of the specified field of the specified record in the tracking layer.
        Parameters:
        fieldname - The name of the specified field.
        dVar - The value of the specified field.
        index - The specified ID
        Returns:
        True if successful; otherwise, false.
      • setFieldInt

        public boolean setFieldInt(java.lang.String fieldname,
                                   int iVar)
        Sets the Int value of the specified name field of the newly added point object in this tracking layer.
        Parameters:
        fieldname - The name of the specified field.
        iVar - The value of the specified field.
        Returns:
        True if successful; otherwise, false.
      • setFieldIntEx

        public boolean setFieldIntEx(java.lang.String fieldname,
                                     int iVar,
                                     int index)
        Sets the Int value of the specified field of the specified record in the tracking layer.
        Parameters:
        fieldname - The name of the specified field.
        iVar - The value of the specified field.
        index - The specified ID
        Returns:
        True if successful; otherwise, false.
      • setFieldString

        public boolean setFieldString(java.lang.String fieldname,
                                      java.lang.String strVar)
        Sets the String value of the specified name field of the newly added point object in this tracking layer.
        Parameters:
        fieldname - The name of the specified field.
        strVar - The value of the specified field.
        Returns:
        True if successful; otherwise, false.
      • setFieldStringEx

        public boolean setFieldStringEx(java.lang.String fieldname,
                                        java.lang.String strVar,
                                        int index)
        Sets the String value of the specified field of the specified record in the tracking layer.
        Parameters:
        fieldname - The name of the specified field.
        strVar - The value of the specified field.
        index - The specified ID
        Returns:
        True if successful; otherwise, false.
      • setLabelCaption

        public boolean setLabelCaption(java.lang.String fieldname,
                                       java.lang.String Caption)
        Sets the label alias of the specified name in tracking layer.
        Parameters:
        fieldname - The name of the specified field.
        Caption - The label alias after modified.
        Returns:
        True if successful; otherwise, false.
      • setLabelOffset

        public boolean setLabelOffset(java.lang.String fieldname,
                                      short x,
                                      short y)
        Sets the specified field offset of the specified name in the tracking layer.
        Parameters:
        fieldname - The name of the specified field.
        x - The offset in x, the unit is the same with the map.
        y - The offset in y, the unit is the same with the map.
        Returns:
        True, if set successfully; Otherwise false.
      • setLabelTextStyle

        public boolean setLabelTextStyle(java.lang.String fieldname,
                                         TextStyle style)
        Sets the field label text style of the specified name as the specified style in this tracking layer.
        Parameters:
        fieldname - The name of the specified field.
        style - The specified style of the text.
        Returns:
        True, if set successfully; Otherwise false.
      • setLabelVisible

        public boolean setLabelVisible(java.lang.String fieldname,
                                       boolean visible)
        Sets whether the field label of the specified name is visible in tracking layer.
        Parameters:
        fieldname - The name of the specified field.
        visible - A boolean, true means visible; Otherwise false.
        Returns:
        Returns true if visible is true; Otherwise false.
      • setSymbolOffset

        public void setSymbolOffset(short x,
                                    short y)
        Sets the specified offset of geometry object in the tracking layer.
        Parameters:
        x - The offset on x direction.
        y - The offset on x direction.
      • get

        public Geometry get(int id)
        Returns the geometric object with the specified index in this tracking layer.
        Parameters:
        id - The ID of the geometric instance to be returned.
        Returns:
        The geometry object of the specified ID.
      • set

        public boolean set(int index,
                           Geometry geometry)
        Replaces the geometric object at the specified index in the TrackingLayer with the specified geometric object and removes the original geometric object.
        Parameters:
        index - The label of the geometric instance to be replaced.
        geometry - The new Geometry object to replace.
        Returns:
        True, if successful; Otherwise false.
      • getTag

        public java.lang.String getTag(int index)
        Returns the tag of geometric object with the specified ID in this tracking layer.
        Parameters:
        index - The index of the geometric instance label to be returned.
        Returns:
        The tag of the Geometry object with the specified index in the tracking layer.
      • setTag

        public boolean setTag(int index,
                              java.lang.String tag)
        Sets the tag of geometric object with the specified ID in this tracking layer.
        Parameters:
        index - The index of the geometric instance label to be set.
        tag - The label of the geometric instance.
        Returns:
        True if successful; otherwise, false.
      • clear

        public void clear()
        Clears all the geometric objects in the tracking layer.
      • hitTest

        public int hitTest(Point2D point2D,
                           double tolerance)
        Returns the ID of the geometric objects that meet the condition. If the distance of the nearest point on the geometric from the point to be tested is within the specified tolerance, then the ID of the geometric object is returned. -1 will be returned if there are not geometric objects meeting the condition in the tracking layer. The ID of the topmost geometric object will be returned if there are multiple overlapped geometric objects that satisfy the condition.
        Parameters:
        point2D - Point to be tested and it is the geographic coordinates.
        tolerance - The specified tolerance is teh geographic length.
        Returns:
        The ID of the Geometry object.
      • hitTestEx

        public int hitTestEx(Point point,
                             int tolerance)
        Returns the ID of the geometric objects that meet the condition. If the distance of the nearest point on the geometric from the point to be tested is within the specified tolerance, then the ID of the geometric object is returned. -1 will be returned if there are not geometric objects meeting the condition in the tracking layer. The ID of the topmost geometric object will be returned if there are multiple overlapped geometric objects that satisfy the condition.
        Parameters:
        point - Point to be tested and it is the geographic coordinates.
        tolerance - The specified tolerance is the screen distance.
        Returns:
        The ID of the Geometry object.
      • indexOf

        public int indexOf(java.lang.String tag)
        Returns the ID of the first geometric object which is identical with the specified tag.
        Parameters:
        tag - The label requiring to check the index.
        Returns:
        The ID of the first geometric object which is identical with the specified tag.
      • setShowGuideLine

        public void setShowGuideLine(boolean bShow,
                                     GeoLineM[] routes,
                                     Point2D start,
                                     Point2D end)
        Sets whether to display the guide lines of the starting point and the ending point
        Parameters:
        bShow - whether to show
        routes - returns the resulting routes object collection
        start - user sets the starting point
        end - user sets the ending point
      • setGuideLineStyle

        public void setGuideLineStyle(GeoStyle style)
        Sets the style of the guide line. The default line is dotted. States before using the method setShowGuideLine()
        Parameters:
        style - Style
      • setAsyncRefresh

        public void setAsyncRefresh(boolean bAsync)
        Sets whether to render the tracing layer instantly
        Parameters:
        bAsync - whether to render instantly. True is by default. If you set false, the application will render the tracing layers hierarchically, which improves the rendering efficiency of tracing layers of big data
      • isAsyncRefresh

        public boolean isAsyncRefresh()
        Returns whether to render the tracing layer instantly
        Returns:
        whether to render the trancing layer instantly
      • hitTestAll

        public int[] hitTestAll(Point2D point,
                                double tolerance)
        Returns all ids of geometry objects that meet the criteria. If the specified point is within the specified tolerance range from the nearest point on the geometry object, the ID of the geometry object is returned If there is no matching geometry in the trace layer, -1 is returned If there are multiple overlapping geometric objects on the map that meet the criteria, the ID of the topmost geometric object is returned
        Parameters:
        point2D - the point to be tested is the geographic coordinate point
        tolerance - specifies the geographical length
        Returns:
        array of geometric object ids
      • hitTestExAll

        public int[] hitTestExAll(Point point,
                                  int tolerance)
        Returns all ids of geometry objects that meet the criteria. If the specified point is within the specified tolerance range from the nearest point on the geometry object, the ID of the geometry object is returned If there is no matching geometry in the trace layer, -1 is returned If there are multiple overlapping geometric objects on the map that meet the criteria, the ID of the topmost geometric object is returned
        Parameters:
        point - Specifies the screen coordinate point to be tested.
        tolerance - Specifies the tolerance of screen distance.
        Returns:
        array of geometric object ids
      • refresh

        public void refresh()
        Track layer refreshes